home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / clang / objeas1a.zip / OBJECT.H < prev    next >
C/C++ Source or Header  |  1992-11-04  |  13KB  |  737 lines

  1. #include <dos.h>
  2. #include <string.h>
  3. #include <graphics.h>
  4.  
  5. #define TRUE 1
  6. #define FALSE 0
  7. #define IN 0
  8. #define OUT 1
  9. #define THICK 0
  10. #define THIN 1
  11. #define TEXT 0
  12. #define IMAGE 1
  13.  
  14. #define ALTA 30
  15. #define ALTB 48
  16. #define ALTC 46
  17. #define ALTD 32
  18. #define ALTE 18
  19. #define ALTF 33
  20. #define ALTG 34
  21. #define ALTH 35
  22. #define ALTI 23
  23. #define ALTJ 36
  24. #define ALTK 37
  25. #define ALTL 38
  26. #define ALTM 50
  27. #define ALTN 49
  28. #define ALTO 24
  29. #define ALTP 25
  30. #define ALTQ 16
  31. #define ALTR 19
  32. #define ALTS 31
  33. #define ALTT 20
  34. #define ALTU 22
  35. #define ALTV 47
  36. #define ALTW 17
  37. #define ALTX 45
  38. #define ALTY 21
  39. #define ALTZ 44
  40.  
  41. #define ALT1 120
  42. #define ALT2 121
  43. #define ALT3 122
  44. #define ALT4 123
  45. #define ALT5 124
  46. #define ALT6 125
  47. #define ALT7 126
  48. #define ALT8 127
  49. #define ALT9 128
  50. #define ALT0 129
  51.  
  52. #define ALTMINUS  130
  53. #define ALTPLUS   131
  54.  
  55. //LIB
  56. void vprintat(int cols,int rows,int fore,int back,char *,...);
  57. void vprintc(int row,int fore,int back,char *,...);
  58. void printat(int,int,int,int,char *);
  59. void printc(int,int,int,char *);
  60. void cprintat(int,int,int,int,char *,...);
  61. void cprintc(int,int,int,char *,...);
  62. void clear(char ch,int fore,int back);
  63. void cursoroff();
  64. void cursoron();
  65. void settext(int,int);
  66. void chsattr(int,int);
  67. void chcattr(int,int,int,int,int);
  68. void dlay(int ticks);
  69. long getticks();
  70. int altkey();
  71. int ctrlkey();
  72. int lshiftkey();
  73. int rshiftkey();
  74. void flushkeys();
  75. unsigned char getvidmode();
  76.  
  77. //MOUSECLASS
  78. class Mcursor {
  79.       int shown;
  80.       int current;
  81.       int xpos;
  82.       int ypos;
  83.       void mouse_interrupt();
  84.       int m1;
  85.       int m2;
  86.       int m3;
  87.       int m4;
  88.       int button;
  89.       int count;
  90.       long tickcount;
  91.       int disabled;
  92.     public:
  93.       int  init();
  94.       void changeto(int);
  95.       void get_status();
  96.       void show();
  97.       void hide();
  98.       void set_hor_bounds(int,int);
  99.       void set_ver_bounds(int,int);
  100.       void Mcursor::conditional_off(int x1,int y1,int x2,int y2);
  101.       void Mcursor::position(int,int);
  102.       int  LBP();
  103.       int  RBP();
  104.       int  getcurrent();
  105.       int  mousex();
  106.       int  mousey();
  107.       int  mx();
  108.       int  my();
  109.       void unarm();
  110.       void arm();
  111.       int  LBDCLK();
  112.       };
  113.  
  114. #define UPARROW 1
  115. #define DOT 2
  116. #define PENCIL 3
  117. #define CROSSHAIR 4
  118. #define ARROW 5
  119. #define FINGER 6
  120. #define POINT 7
  121. #define CLOCK 8
  122. #define DISK 9
  123. #define IBAR 10
  124. #define PAINTCAN 11
  125. #define HAND 12
  126. #define ERASOR 13
  127. #define GUNSIGHT 14
  128. #define SCISSORS 15
  129. #define JAWS 16
  130.  
  131.  
  132. //WINDOW
  133. typedef unsigned char screenbuff[4000];
  134. typedef char itemarray[24][80];
  135.  
  136. #define SINGLE 0
  137. #define DOUBLE 1
  138. #define HOR 0
  139. #define VER 1
  140.  
  141. class Twindow{
  142.     protected:
  143.         int x;
  144.         int y;
  145.         int x1;
  146.         int y1;
  147.         int fgd;
  148.         int bgd;
  149.         int shad;
  150.         int shadcolor;
  151.         int size;
  152.         char id[15];
  153.         int existtitle;
  154.         int bordertype;
  155.         int shown;
  156.         screenbuff *save;
  157.     public:
  158.         Twindow();
  159.         ~Twindow();
  160.         void getstyle();
  161.         void init(int xpos,int ypos,int x1pos,int y1pos,
  162.         int fore,int back,int shadow,int shadowcolor);
  163.         void border();
  164.         void setborder(int style);
  165.         int  getborder();
  166.         void cfgd(int fore);
  167.         void cbgd(int back);
  168.         int  getfgd();
  169.         int  getbgd();
  170.         void fill();
  171.         void divider(int direction,int style,int offset);
  172.         void show();
  173.         void zoom();
  174.         void hide();
  175.         void elim();
  176.         void title(char txt[15]);
  177.         int  istitle();
  178.         int isshown();
  179.         int isx();
  180.         int isy();
  181.         int isx1();
  182.         int isy1();
  183.         int issize();
  184.         void wprintat(int,int,int,int,char*);
  185.         void wprintc(int,int,int,char*);
  186.         };
  187.  
  188. class Tmenu:public Twindow{
  189.     protected:
  190.         int itemcount;
  191.         itemarray items;
  192.         int hifore;
  193.         int hiback;
  194.         int menuchoice;
  195.     public:
  196.         void init(int itemcnt,itemarray item,int xpos,int ypos,int width,
  197.         int fore,int back,int hfore,int hback,
  198.         int shadow,int shadowcolor);
  199.         int show();
  200.         void move(int xpos,int ypos);
  201.         };
  202.  
  203. //INPUT
  204. class Tstring {
  205.     protected:
  206.         char laststring[81];
  207.         char bar[81];
  208.         int xpos;
  209.         int x;
  210.         int y;
  211.         int length;
  212.         int ucase;
  213.         int escape;
  214.         int retrn;
  215.         int tab;
  216.         int uparrow;
  217.         int dnarrow;
  218.         int shown;
  219.         int barred;
  220.         int firstchar;
  221.         int infgd;
  222.         int inbgd;
  223.     public:
  224.         Tstring();
  225.         ~Tstring();
  226.         void init(int xloc,int yloc,int len,int uppercase);
  227.         void show();
  228.         void input();
  229.         void get_input();
  230.         void get_form_input();
  231.         void get_form_mouse_input();
  232.         void reset();
  233.         void preset(char *);
  234.         void erase(int);
  235.         char *getstring();
  236.         int escapehit();
  237.         int returnhit();
  238.         int tabhit();
  239.         int uparrowhit();
  240.         int dnarrowhit();
  241.         int isshown();
  242.         int isbarred();
  243.         int hit();
  244.         void setincolors(int,int);
  245.         };
  246.  
  247.  
  248. class Tnumeral:public Tstring {
  249.     protected:
  250.         int real;
  251.         int end;
  252.     public:
  253.         void init(int xloc,int yloc,int len,int int_or_float);
  254.         void show();
  255.         void get_input();
  256.         void get_form_input();
  257.         void get_form_mouse_input();
  258.         void input();
  259.         float getfloat();
  260.         int getint();
  261.         long getlong();
  262.         };
  263.  
  264.  
  265.  
  266. class Tdate:public Tstring {
  267.     protected:
  268.         int date_ok;
  269.     public:
  270.         void init(int xloc,int yloc);
  271.         void show();
  272.         void get_input();
  273.         void validate();
  274.         int  verified();
  275.         char *getdatestring();
  276.         long getdate();
  277.         };
  278.  
  279. #ifdef __LARGE__
  280.  
  281. class Gstring:public Tstring {
  282.     protected:
  283.         int curpos;
  284.         int curson;
  285.         void showcurs();
  286.         void hidecurs();
  287.     public:
  288.         void init(int,int,int,int);
  289.         void show();
  290.         void input();
  291.         void get_input();
  292.         void get_form_input();
  293.         void reset();
  294.         int isshown();
  295.         void check_for_blink();
  296.         };
  297.  
  298. #endif
  299.  
  300. //TBUTTON
  301. class Tbutton {
  302.     protected:
  303.         int xpos;
  304.         int ypos;
  305.         int width;
  306.         int pressed;
  307.         int hilite;
  308.         char button[81];
  309.         char shadow[81];
  310.         char id[41];
  311.     public:
  312.         Tbutton();
  313.         void init(int,int,char *,int);
  314.         ~Tbutton();
  315.         void show(int);
  316.         int buttonpressed();
  317.         int hit();
  318.         void press(int);
  319.         int ispressed();
  320.         };
  321.  
  322.  
  323. class Tcheckbox {
  324.     protected:
  325.         int xpos;
  326.         int ypos;
  327.         int fgd;
  328.         int bgd;
  329.         int checked;
  330.     public:
  331.         Tcheckbox();
  332.         void init(int,int,int,int);
  333.         ~Tcheckbox();
  334.         void show();
  335.         void grabcursor();
  336.         int hit();
  337.         void check();
  338.         void uncheck();
  339.         int ischecked();
  340.         };
  341.  
  342. //VIDBIOS
  343. void set_default_palette();
  344. void blankcolor(int);
  345. void fade1_3();
  346. void fade3_1();
  347. void fade1_4();
  348. void fade4_1();
  349. void fade1_5();
  350. void fade5_1();
  351. void fadein(int);
  352. void fadeout(int);
  353. void rgb(int,int,int,int);
  354. void make_grayscale();
  355. void screenbord(int);
  356. void disable_blink();
  357. void enable_blink();
  358. void disable_refresh();
  359. void enable_refresh();
  360.  
  361. //GROBJECT
  362.  
  363. #ifdef __LARGE__
  364.  
  365. class Point
  366. {
  367.     protected:
  368.         int x,y,color;
  369.         viewporttype vref;
  370.     public:
  371.         Point();
  372.         void move(int ptx,int pty);
  373.         virtual void draw();
  374.         void create(int ptx,int pty,int c);
  375.         void restoreviewport();
  376.         void Setcolor(int c);
  377.         virtual void setloc(int ptx,int pty);
  378.         virtual void erase();
  379.         int Getcolor();
  380.         int Getx();
  381.         int Gety();
  382.         };
  383.  
  384. //************************************************************************
  385.  
  386. class Colorbutton:public Point
  387. {
  388.     protected:
  389.         int color;
  390.         int width;
  391.         int height;
  392.     public:
  393.         void init(int,int,int,int,int);
  394.         void show(int);
  395.         int  clicked();
  396.         int     hit();
  397.         int getcolor();
  398.         };
  399.  
  400. //************************************************************************
  401.  
  402. class Closebutton:public Colorbutton
  403. {
  404.     public:
  405.         void  show();
  406.         };
  407.  
  408. //************************************************************************
  409.  
  410. class Icon:public Point
  411. {
  412.     protected:
  413.         int state;
  414.     public:
  415.         void far *picture;
  416.         Icon();
  417.         ~Icon();
  418.         void init(int,int,char*);
  419.         void show();
  420.         void choose();
  421.         int hit();
  422.         int clicked();
  423.         int ispressed();
  424.         };
  425.  
  426. //************************************************************************
  427.  
  428. class Gcheckbox:public Point
  429. {
  430.     protected:
  431.         int checked;
  432.         char *desc;
  433.         int length;
  434.     public:
  435.         Gcheckbox();
  436.         ~Gcheckbox();
  437.         void init(int,int,char *);
  438.         void show();
  439.         void check();
  440.         void uncheck();
  441.         int is_checked();
  442.         int hit();
  443.         };
  444.  
  445. //************************************************************************
  446.  
  447. class Gradio:public Gcheckbox
  448. {
  449.     public:
  450.         void show();
  451.         void check();
  452.         void uncheck();
  453.         };
  454.  
  455. //************************************************************************
  456.  
  457. class Acticon:public Icon
  458. {
  459.     protected:
  460.         void *picture[32];
  461.         int state;
  462.         int numpix;
  463.     public:
  464.         Acticon();
  465.         ~Acticon();
  466.         void init(int,int,char*);
  467.         void show(int);
  468.         void choose();
  469.         int ispressed();
  470.         void animate(int);
  471.         void backforth(int);
  472.         };
  473.  
  474. //************************************************************************
  475.  
  476. class Button:public Point
  477. {
  478.     protected:
  479.         int state,sizex,sizey;
  480.         char btntxt[40];
  481.         int  file_text;
  482.         void far *picture;
  483.         void getpic(char*);
  484.     public:
  485.         Button();
  486.         ~Button();
  487.         virtual void show();
  488.         virtual void press();
  489.         void init(int ptx,int pty,char* text,int);
  490.         int hit();
  491.         int pressed();
  492.         };
  493.  
  494. //************************************************************************
  495.  
  496. class Bitmap:public Point
  497. {
  498.     protected:
  499.         int sizex,sizey;
  500.         int size;
  501.         void far *picture;
  502.         int shown;
  503.         int clickcount;
  504.         long last_tick;
  505.     public:
  506.         Bitmap();
  507.         ~Bitmap();
  508.         void init(int,int);
  509.         void load(char *);
  510.         void save(char *);
  511.         void show_XOR();
  512.         void show_COPY();
  513.         void show_AND();
  514.         void show_OR();
  515.         void show_NOT();
  516.         int is_shown();
  517.         void hide();
  518.         void moveto(int,int);
  519.         int capture(int,int,int,int);
  520.         int hit();
  521.         int clicked();
  522.         int LBDCLK();
  523.         int LBSCLK();
  524.         int xsize();
  525.         int ysize();
  526.         int bitmapx();
  527.         int bitmapy();
  528.         void changexy(int,int);
  529.         };
  530.  
  531. //************************************************************************
  532.  
  533. class Panel:public Point
  534. {
  535.     protected:
  536.         int w;
  537.         int h;
  538.         int in_or_out;
  539.         int thick_or_thin;
  540.     public:
  541.         Panel();
  542.         ~Panel();
  543.         virtual void show();
  544.         void init(int,int,int,int,int,int);
  545.         };
  546.  
  547. //************************************************************************
  548.  
  549. class Bevel:public Point
  550. {
  551.     private:
  552.         int w;
  553.         int h;
  554.         int thick_or_thin;
  555.         Panel outerbevel;
  556.         Panel innerbevel;
  557.     public:
  558.         void init(int,int,int,int,int);
  559.         virtual void show();
  560.         };
  561.  
  562. //************************************************************************
  563.  
  564. class OKbox:public Point
  565. {
  566.     protected:
  567.         Button OKbutton;
  568.         Button ESCbutton;
  569.         Panel panel;
  570.         char text[90];
  571.         void *screen;
  572.         int OKorNOT;
  573.     public:
  574.         OKbox();
  575.         ~OKbox();
  576.         void init(int,int,char*);
  577.         int show();
  578.         };
  579.  
  580. //************************************************************************
  581.  
  582. class Gwindow:public Point
  583. {
  584.     protected:
  585.         Closebutton closebox;
  586.         int            w,h;
  587.         int            fgd,bgd;
  588.         int            tfgd,tbgd;
  589.         int            active;
  590.         char        title[48];
  591.         void        *beneath;
  592.     public:
  593.         Gwindow(int,int,int,int,int,int,int,int,char *);
  594.         ~Gwindow();
  595.         void show();
  596.         void redraw();
  597.         void hide();
  598.         int     closeboxhit();
  599.         int  sizecornerhit();
  600.         int  titlebarhit();
  601.         void resize();
  602.         void move();
  603.         int write_to_disk();
  604.         int read_from_disk();
  605.         };
  606.  
  607. //GMENU
  608. typedef char gitemarray[80][10];
  609.  
  610.  
  611. class Gmenu {
  612.     protected:
  613.         int on;
  614.         int x,y,w,h;
  615.         int num;
  616.         gitemarray gitems;
  617.         int menuchoice;
  618.         int oldbarx,oldbary;
  619.         void *ptr;
  620.         void *menubar;
  621.     public:
  622.         Gmenu();
  623.         ~Gmenu();
  624.         void init(int xloc,int yloc,int numentries,gitemarray gitem);
  625.         int show();
  626.         void hide();
  627.         int isshown();
  628.         };
  629.  
  630. class Gmenubutton {
  631.     protected:
  632.         int on;
  633.         int x,y;
  634.         int offfgd,offbgd;
  635.         int onfgd,onbgd;
  636.         char id[20];
  637.     public:
  638.         Gmenubutton();
  639.         ~Gmenubutton();
  640.         void init(int xloc,int yloc,int ffgd,int fbgd,
  641.         int nfgd,int nbgd,char txt[20]);
  642.         void show();
  643.         void press();
  644.         int hit();
  645.         };
  646.  
  647. //GPRINT
  648. void gprintf(int xloc,int yloc,char *fmt,...);
  649. void gprintc(int xloc, int yloc, char *fmt,...);
  650. void gprintxy(int xloc,int yloc,char *fmt,...);
  651.  
  652. #endif
  653.  
  654. //MISC
  655. void smover(int row,int startpos,int endpos,int fgd,int bgd,char *string);
  656. void smovel(int row,int startpos,int endpos,int fgd,int bgd,char *string);
  657. void smoveu(int col,int startpos,int endpos,int fgd,int bgd,char *string);
  658. void smoved(int col,int startpos,int endpos,int fgd,int bgd,char *string);
  659.  
  660.  
  661. //SOUNDQ
  662. #define TimerTick 0x8
  663. #define noisemax 8192
  664. #define ON 1
  665. #define OFF 0
  666.  
  667. #define C 523
  668. #define CS 554
  669. #define D 587
  670. #define DS 622
  671. #define E 659
  672. #define F 698
  673. #define FS 740
  674. #define G 784
  675. #define GS 831
  676. #define A 880
  677. #define AS 932
  678. #define B 988
  679. #define C1 1046
  680.  
  681. #define SN 32
  682. #define EN 63
  683. #define QN 125
  684. #define HN 250
  685. #define WN 500
  686.  
  687. #define ENT 20
  688. #define QNT 41
  689. #define HNT 83
  690.  
  691. #define BN 30000,5
  692. #define SR 30000,32
  693. #define ER 30000,63
  694. #define QR 30000,125
  695. #define HR 30000,250
  696. #define WR 30000,500
  697. #define NM 30000,1
  698.  
  699. class SoundQ{
  700.     protected:
  701.         float speed_factor;
  702.     public:
  703.         SoundQ();
  704.         ~SoundQ();
  705.         void play(int,int);
  706.         void adjust_speed(float);
  707.         };
  708.  
  709. typedef struct
  710. {
  711.   int duration;
  712.   int freq;
  713. } noise;
  714.  
  715. void empty_sound_queue();
  716. void init_sound(void);
  717. void restore_sound(void);
  718. int submit_sound(int freq,int delay);
  719. void interrupt soundsystem(...);
  720.  
  721. //SCREEN
  722. extern "C" void     _Cdecl vga256_driver();
  723.  
  724. class Screen {
  725.     protected:
  726.         static int huge alwayszero();
  727.     public:
  728.         Screen();
  729.         ~Screen();
  730.         int VGAH();
  731.         int VGAM();
  732.         int VGAL();
  733.         int VGA256();
  734.         void fill(int);
  735.         };
  736.  
  737.